<div class="group-permissions">
    <div class="realm-group-permissions group-permissions-section {{#if group_has_no_realm_permissions}}hide{{/if}}">
        <h3>{{t "Organization permissions"}}</h3>

        {{#each group_assigned_realm_permissions}}
            <div class="settings-subsection-parent {{subsection_key}} {{#unless assigned_permissions.length}}hide{{/unless}}">
                <div class="subsection-header">
                    <h3>{{subsection_heading}}</h3>
                    {{> ../settings/settings_save_discard_widget show_only_indicator=false }}
                </div>

                <div class="subsection-settings">
                    {{#each assigned_permissions}}
                        {{> ../settings/settings_checkbox
                          setting_name=setting_name
                          prefix="id_group_permission_"
                          is_checked=true
                          label=(lookup ../../all_group_setting_labels.realm setting_name)
                          is_disabled=(not can_edit)
                          tooltip_message=tooltip_message}}
                    {{/each}}
                </div>
            </div>
        {{/each}}
    </div>

    <div class="channel-group-permissions group-permissions-section {{#unless group_assigned_stream_permissions.length}}hide{{/unless}}">
        <h3>{{t "Channel permissions"}}</h3>

        {{#each group_assigned_stream_permissions}}
            {{> stream_group_permission_settings
              stream=stream
              assigned_permissions=assigned_permissions
              setting_labels=../all_group_setting_labels.stream
              id_prefix=id_prefix
              }}
        {{/each}}
    </div>

    <div class="user-group-permissions group-permissions-section {{#unless group_assigned_user_group_permissions.length}}hide{{/unless}}">
        <h3>{{t "User group permissions"}}</h3>

        {{#each group_assigned_user_group_permissions}}
            {{> user_group_permission_settings
              group_id=group_id
              group_name=group_name
              assigned_permissions=assigned_permissions
              setting_labels=../all_group_setting_labels.group
              id_prefix=id_prefix
              }}
        {{/each}}
    </div>
</div>
